package signalprocessing;

import ikelib.drawTools;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;

/**
 * 
 */

/**
 * XYプロットを表示する。
 * 
 * @author ikechan
 *
 */
public class PlotTemperature extends PlotPaneYX {
	
	
	public PlotTemperature() {
		super();
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static final int TopMargin    = 2;
	//private static final int BottomMargin = 2;
	private static final int LeftMargin   = 10;
	//private static final int RightMargin  = 10;
	
	
	
	@Override
	public void paintComponent(Graphics g){
		// super.paintComponent(g);   
		Dimension dm = this.getSize();
		Graphics2D g2 = (Graphics2D)g;
		if(Col!=null){
			g2.setBackground(Col.ColorBackGround);
			g2.setColor(Col.ColorDataBW);
		}
		g2.clearRect(0,0,dm.width,dm.height);

		
		Rectangle rc = new Rectangle(new Point(),dm);// graphエリア
		if(YAxis != null){
			YAxis.drawScale(g2,PlotAxis.AxisPlacedRight,rc);//振幅軸の軸を書く
			XAxis.drawScale(g2,PlotAxis.AxisPlacedBottom,rc);//振幅軸の軸を書く
		}
		drawZero(true);
		//setViewRect(rc);
		PointCalcXY(rc);
		
		Integer[] idary = getChannel();
		PlotPoint(g2);	// データを描画
	}
	
	public void repaintAllComponent(){
		Rectangle r = new Rectangle(0,0,getWidth(),getHeight());
		repaint(r);
		//getParent().repaint();
		if(YAxis!=null){
			YAxis.repaintAll();
		}
		if(XAxis!=null){
			XAxis.repaintAll();
		}
	}
	/* (non-Javadoc)
	 * @see winchkgpkg.BasicView#onDataChange()
	 */
	@Override
	void onDataChange() {
		if(PolyLineCalc()){
			repaintAllComponent();
		}
	}
}
